package File;

import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.*;

/**
 * @description:
 * @author: cyy
 **/
public class file {
    public static void main(String[] args) {

        try {
            InputStream resourceAsStreamold = null;
            try {
                resourceAsStreamold = new FileInputStream(new File("D:\\\\idea_project\\\\leetcode\\\\leetcode\\\\src\\\\com\\\\demoLearn\\\\net_quality_detail.xlsx"));
            } catch (FileNotFoundException fileNotFoundException) {
                fileNotFoundException.printStackTrace();
            }
            OutputStream OutputStream = null;
            try {
                OutputStream = new FileOutputStream(new File("D:\\\\idea_project\\\\leetcode\\\\leetcode\\\\src\\\\com\\\\demoLearn\\\\net_quality_detail2.xlsx"));
            } catch (FileNotFoundException fileNotFoundException) {
                fileNotFoundException.printStackTrace();
            }
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(resourceAsStreamold));
            BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(OutputStream));
            StringBuffer stringBuffer = new StringBuffer();
            try {
                String line;
                boolean flag = true;
                while ((line = bufferedReader.readLine()) != null) {
                    // ... do something with line
                    stringBuffer.append(line);
                    System.out.println("shitutuya:" + line);
                }
                System.out.println("shitutuya2:" + new StringBuffer().toString());
                bufferedWriter.write(stringBuffer.toString());
            } catch (IOException e) {
                // ... handle IO exception
            } finally {

            }
        } catch (Exception e) {

        }



        try {
            FileInputStream fileInputStream = null;
            FileOutputStream file = null;
            try {
                fileInputStream = new FileInputStream("");
                file = new FileOutputStream("");
            } catch (FileNotFoundException ex) {
                throw new RuntimeException(ex);
            }

            InputStreamReader fileReader = null;
            OutputStreamWriter FileWriter = null;
            try {
                fileReader = new InputStreamReader(fileInputStream, "UTF-8");
                FileWriter = new OutputStreamWriter(file, "UTF-8");
            } catch (UnsupportedEncodingException ex) {
                throw new RuntimeException(ex);
            }
            BufferedReader bufferedReader = new BufferedReader(fileReader);
            BufferedWriter bufferedWriter = new BufferedWriter(FileWriter);
            String line = null;
            while (true) {
                try {
                    if (!((line = bufferedReader.readLine()) != null)) break;
                    bufferedWriter.append(line);
                } catch (IOException ex) {
                    throw new RuntimeException(ex);
                }
            }

        }catch (Exception e) {

        }
    }
     /*try (FileInputStream fis = new FileInputStream("D:\\idea_project\\leetcode\\leetcode\\src\\com\\demoLearn\\net_quality_detail.xlsx");
           FileOutputStream fos = new FileOutputStream("D:\\idea_project\\leetcode\\leetcode\\src\\com\\demoLearn\\net_quality_detail2.xlsx")) {
            int len;
            byte[] buffer = new byte[1024];
            while ((len = fis.read(buffer)) > 0) {
                fos.write(buffer, 0, len);
            }
        } catch (IOException e) {
            // ... handle IO exception
        }*/


}


